import QtQuick 1.0

Item {
    id: _root


    //////////////////////////////////////////////////////////
    // properties

    // OAuth settings
    property string consumerSecret: ""
    property string consumerKey: ""

    // User Infomations
    property string oauthToken: ""
    property string oauthTokenSecret: ""
    property string screenName: ""
    property string userId: ""

    // format
    property int format: 0

    // output
    // property string xml: ""     // last result
    // 最後に実行した結果こんな風にするとお手軽にプロパティバインドで使える？


    //////////////////////////////////////////////////////////
    // changed

    //////////////////////////////////////////////////////////
    // signals

    // 1.response request token
    signal responseRequestToken(string url)
    // 2.response access token
    signal responseAccessToken(string token, string token_secret
                               , string screen_name, string user_id)

    // Timelines
    // HomeTimeline
    signal responseHomeTimeline(string text)
    signal responseMentions(string text)
    signal responsePublicTimeline(string text)
    signal responseRetweetedByMe(string text)
    signal responseRetweetedToMe(string text)
    signal responseRetweetedOfMe(string text)
    signal responseUserTimeline(string text)
    signal responseRetweetedToUser(string text)
    signal responseRetweetedByUser(string text)


    // Tweets
    // update
    signal responseStatusesShow(string text)
    signal responseStatusesRetweet(string text)
    signal responseStatusesUpdate(string text)

    // Search
    signal responseSearch(string text)

    // Direct Messages
    signal responseDirectMessages(string text)
    signal responseDirectMessagesSent(string text)

    // Friends and Followers
    signal responseFollowersIds(string text)
    signal responseFriendsIds(string text)
    signal responseFriendshipsCreate(string text)
    signal responseFriendshipsDestory(string text)
    signal responseFriendshipsLookup(string text)


    // Favorites
    signal responseFavorites(string text)
    signal responseFavoritesCreate(string text)
    signal responseFavoritesDestory(string text)


    // Lists
    signal responseListsStatuses(string text)
    signal responseLists(string text)
    signal responseListsSubscriptions(string text)

    // Saved Searches
    signal responseSavedSearhes(string text)
    signal responseSavedSearhesShow(string text)
    signal responseSavedSearhesCreate(string text)
    signal responseSavedSearhesDestory(string text)


    //////////////////////////////////////////////////////////
    // authrize
    property alias auth: _auth
    QMLTwitterAuth{
        id: _auth
        consumerSecret: _root.consumerSecret
        consumerKey: _root.consumerKey
        oauthToken: _root.oauthToken
        oauthTokenSecret: _root.oauthTokenSecret
        screenName: _root.screenName
        userId: _root.userId

        //////////////////////////////////////////////////////////
        // events

        onResponseRequestToken: {
            _root.responseRequestToken(url);
        }
        onResponseAccessToken: {
            _root.responseAccessToken(token, token_secret
                                , screen_name, user_id);
        }
    }

    //////////////////////////////////////////////////////////
    // Timelines
    property alias timelines: _timelines
    QMLTwitterTimelines{
        id: _timelines
        consumerSecret: _root.consumerSecret
        consumerKey: _root.consumerKey
        oauthToken: _root.oauthToken
        oauthTokenSecret: _root.oauthTokenSecret
        screenName: _root.screenName
        userId: _root.userId
        format: _root.format

        //////////////////////////////////////////////////////////
        // events

        onResponseHomeTimeline: {
            _root.responseHomeTimeline(text);
        }
        onResponseMentions: {
            _root.responseMentions(text);
        }
        onResponsePublicTimeline: {
            _root.responsePublicTimeline(text);
        }
        onResponseRetweetedByMe: {
            _root.responseRetweetedByMe(text);
        }
        onResponseRetweetedToMe: {
            _root.responseRetweetedToMe(text);
        }
        onResponseRetweetedOfMe: {
            _root.responseRetweetedOfMe(text);
        }
        onResponseUserTimeline: {
            _root.responseUserTimeline(text);
        }
        onResponseRetweetedToUser: {
            _root.responseRetweetedToUser(text);
        }
        onResponseRetweetedByUser: {
            _root.responseRetweetedByUser(text);
        }
    }

    //////////////////////////////////////////////////////////
    // Tweets
    property alias tweets: _tweets
    QMLTwitterTweets{
        id: _tweets
        consumerSecret: _root.consumerSecret
        consumerKey: _root.consumerKey
        oauthToken: _root.oauthToken
        oauthTokenSecret: _root.oauthTokenSecret
        screenName: _root.screenName
        userId: _root.userId
        format: _root.format

        //////////////////////////////////////////////////////////
        // events

        onResponseStatusesShow: {
            _root.responseStatusesShow(text);
        }
        onResponseStatusesRetweet: {
            _root.responseStatusesRetweet(text);
        }
        // update
        onResponseStatusesUpdate: {
            _root.responseStatusesUpdate(text);
        }
    }

    //////////////////////////////////////////////////////////
    // Search
    property alias search: _search
    QMLTwitterSearch{
        id: _search
        consumerSecret: _root.consumerSecret
        consumerKey: _root.consumerKey
        oauthToken: _root.oauthToken
        oauthTokenSecret: _root.oauthTokenSecret
        screenName: _root.screenName
        userId: _root.userId
        format: _root.format

        //////////////////////////////////////////////////////////
        // events
        onResponseSearch: {
            _root.responseSearch(text);
        }
    }

    //////////////////////////////////////////////////////////
    // Direct Messages
    property alias directmessages: _directmessages
    QMLTwitterDirectMessages{
        id: _directmessages
        consumerSecret: _root.consumerSecret
        consumerKey: _root.consumerKey
        oauthToken: _root.oauthToken
        oauthTokenSecret: _root.oauthTokenSecret
        screenName: _root.screenName
        userId: _root.userId
        format: _root.format

        //////////////////////////////////////////////////////////
        // events
        onResponseDirectMessages: {
            _root.responseDirectMessages(text);
        }
        onResponseDirectMessagesSent: {
            _root.responseDirectMessagesSent(text);
        }
    }

    //////////////////////////////////////////////////////////
    // Friends and Followers
    property alias friendAndFollowers: _friendsAndFollowers
    QMLTwitterFriendsAndFollowers{
        id: _friendsAndFollowers

        consumerSecret: _root.consumerSecret
        consumerKey: _root.consumerKey
        oauthToken: _root.oauthToken
        oauthTokenSecret: _root.oauthTokenSecret
        screenName: _root.screenName
        userId: _root.userId
        format: _root.format

        //////////////////////////////////////////////////////////
        // events

        onResponseFollowersIds: {
            _root.responseFollowersIds(text);
        }
        onResponseFriendsIds: {
            _root.responseFriendsIds(text);
        }

        onResponseFriendshipsCreate: {
            _root.responseFriendshipsCreate(text);
        }
        onResponseFriendshipsDestory: {
            _root.responseFriendshipsDestory(text);
        }

        onResponseFriendshipsLookup: {
            _root.responseFriendshipsLookup(text);
        }
    }

    //////////////////////////////////////////////////////////
    // Favorites
    property alias favorites: _favorites
    QMLTwitterFavorites{
        id: _favorites
        consumerSecret: _root.consumerSecret
        consumerKey: _root.consumerKey
        oauthToken: _root.oauthToken
        oauthTokenSecret: _root.oauthTokenSecret
        screenName: _root.screenName
        userId: _root.userId
        format: _root.format

        //////////////////////////////////////////////////////////
        // events

        onResponseFavorites: {
            _root.responseFavorites(text);
        }
        onResponseFavoritesCreate: {
            _root.responseFavoritesCreate(text);
        }
        onResponseFavoritesDestory: {
            _root.responseFavoritesDestory(text);
        }
    }


    //////////////////////////////////////////////////////////
    // Lists
    property alias lists: _lists
    QMLTwitterLists{
        id: _lists
        consumerSecret: _root.consumerSecret
        consumerKey: _root.consumerKey
        oauthToken: _root.oauthToken
        oauthTokenSecret: _root.oauthTokenSecret
        screenName: _root.screenName
        userId: _root.userId
        format: _root.format

        //////////////////////////////////////////////////////////
        // events
        onResponseListsStatuses: {
            _root.responseListsStatuses(text);
        }

        onResponseLists: {
            _root.responseLists(text);
        }

        onResponseListsSubscriptions: {
            _root.responseListsSubscriptions(text);
        }
    }

    //////////////////////////////////////////////////////////
    // Saved Searches
    property alias savedSearches: _savedSearches
    QMLTwitterSavedSearches{
        id: _savedSearches
        consumerSecret: _root.consumerSecret
        consumerKey: _root.consumerKey
        oauthToken: _root.oauthToken
        oauthTokenSecret: _root.oauthTokenSecret
        screenName: _root.screenName
        userId: _root.userId
        format: _root.format

        //////////////////////////////////////////////////////////
        // events
        onResponseSavedSearhes: {
            _root.responseSavedSearhes(text)
        }
        onResponseSavedSearhesShow: {
            _root.responseSavedSearhesShow(text)
        }
        onResponseSavedSearhesCreate: {
            _root.responseSavedSearhesCreate(text)
        }
        onResponseSavedSearhesDestory: {
            _root.responseSavedSearhesDestory(text)
        }
    }
}
